package com.why.mtqq.test;

import org.eclipse.paho.client.mqttv3.IMqttMessageListener;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.stereotype.Component;

@Component
public class MqttMessageListener implements IMqttMessageListener {
    private String topic="MQTT_Examples";
    @Override
    public void messageArrived(String s, MqttMessage mqttMessage) throws Exception {
        this.topic=s;
        System.out.println("-------------->"+mqttMessage);
    }
}
